<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:wh="http://java.sun.com/jsf/composite/wh"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
			<h:form id="form" styleClass="horizontal_full">
				<p:panel>
					<p:breadCrumb>
						<p:menuitem value="Categories" url="adminGameManagement.xhtml#" />
						<p:menuitem value="#{adminMBean.selectedGame.name}"
							url="adminGameManagement.xhtml#" />
						<p:menuitem value="Round #{adminMBean.selectedRound.roundNumber}"
							url="adminRoundManagement.xhtml#" />
					</p:breadCrumb>

					<h1>Agent-type Management</h1>
					<p>
						Allows you to configure, delete and create an agenttype for the specific round that is used to create the agents that will simulate the customers in the market with their preferences. The values for
						the agent creation can be configured in the game settings.
					</p>
					<p>
						Agent-Amount-Recommendation:  #{adminMBean.getAgentAmountRecommendation()} Agents
					</p>
					<p:dataTable id="agentTypeTable" var="agentType"
						value="#{adminMBean.selectedRound.agentTypes}"
						selectionMode="single" rowKey="#{agentType.id}"
						paginatorTemplate="{RowsPerPageDropdown} {CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
						rowsPerPageTemplate="10,25,50,100,100" paginator="true" rows="100">

						<f:facet name="header">
					            AgentType Overview for Round #{adminMBean.selectedRound.roundNumber} in Game #{adminMBean.selectedGame.name}
					        </f:facet>

						<p:column headerText="Name" sortBy="#{agentType.agentName}">
							<h:outputText value="#{agentType.agentName}" />
						</p:column>
					<!-- nach Besprechung am 27.03 nicht notwendig
						<p:column headerText="Money per Period"
							sortBy="#{agentType.moneyPerPeriod}">
							<h:outputText value="#{agentType.moneyPerPeriod}" />
						</p:column>
					-->
						<p:column headerText="Amount" sortBy="#{agentType.amount}">
							<h:outputText value="#{agentType.amount}" />
						</p:column>
					
						
						<p:column headerText="Mean Price" sortBy="#{agentType.meanPrice}">
							<h:outputText value="#{agentType.meanPrice}" />
						</p:column>
					
						<p:column headerText="Mean Quality"
							sortBy="#{agentType.meanQuality}">
							<h:outputText value="#{agentType.meanQuality}" />
						</p:column>


						<p:column headerText="Mean Image" sortBy="#{agentType.meanImage}">
							<h:outputText value="#{agentType.meanImage}" />
						</p:column>
						
						<p:column headerText="Show Agents">
							<p:commandButton icon="ui-icon-search" title="View"
								action="#{adminMBean.actionShowAgents()}">
								<f:setPropertyActionListener value="#{agentType}"
									target="#{adminMBean.selectedAgentType}" />
							</p:commandButton>
						</p:column>

						<p:column headerText="Configure Agenttype">
							<p:commandButton icon="ui-icon-gear" title="Configure"
								action="#{adminMBean.actionGoToUpdateAgentType()}"
								disabled="#{adminMBean.selectedRound.played}">
								<f:setPropertyActionListener value="#{agentType}"
									target="#{adminMBean.selectedAgentType}" />
							</p:commandButton>
						</p:column>

						<p:column headerText="Delete Agenttype">
							<p:commandButton icon="ui-icon-circle-minus" title="Delete"
								action="#{adminMBean.actionDeleteAgentType()}"
								disabled="#{adminMBean.selectedRound.played}"
								update="agentTypeTable">
								<f:setPropertyActionListener value="#{agentType}"
									target="#{adminMBean.selectedAgentType}" />
							</p:commandButton>
						</p:column>
						
						<f:facet name="footer">
							<p:commandButton value="Add Agenttype"
								action="#{adminMBean.actionGoToCreateAgentType()}"
								update="agentTypeTable" icon="ui-icon-circle-plus"
								disabled="#{adminMBean.selectedRound.played}" />
						</f:facet>

					</p:dataTable>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>